﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DotNetChatServer.Interfaces;

namespace DotNetChatServer {
	public class ChatServerSingleton {
		private static ChatServerSingleton myInstance = null;
		private static object myLock = new object();

		public IChatMemberCollection Members { get; private set; }
		public IMessageStorage Messages { get; private set; }

		public static ChatServerSingleton Instance {
			get {
				if (myInstance == null) {
					lock (myLock) {
						myInstance = new ChatServerSingleton();
					}
				}
				return myInstance;
			}
		}
		private ChatServerSingleton() {
			Members = new SimpleMemberStorage();
			Messages = new SimpleMessageStorage();
		}
	}
}
